home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World Komputer 2010 April
/
PCWorld0410.iso
/
pluginy Firefox
/
1833
/
1833.xpi
/
chrome
/
m
/
yoono.com
/
sidebar.jar
/
sidebar
/
js
/
sidebar.js
< prev
next >
Wrap
Text File
|
2009-12-16
|
49KB
|
1 lines
var ynSidebar=null;var ms=null;function Sidebar(b){YServices.browser.notifySidebarOpen(b,this);this.isClosing=false;this.yoodgetInitialized=false;this.yoodgets=new Object();this.doc=document;this.YEXTIF=window.YEXTIF;this.YINTIF=window.YINTIF;this.fixLayoutTimer=null;this._singleYoodgetWrapper=null;this.rookieDuration=11;this.thinContextMenu=null;this._searchContainerBox=$("search-container-box");this._searchContainer=$("search-container");this.signinThrobber=new ThrobberCtrl($("signin-throbber"));this.statusMax=140;this.loginTryCounter=0;var a=this;this._widgetsToAdd=new Array();this._addWidgetTimer=null;this.YINTIF.methods.isYoodgetPresent=function(f){var e=a.isYoodgetPresent(f);return(e)};this.YINTIF.methods.callYoodget=function(g,f,i,h){var e=a.callYoodget("extension",g,f,i,h);return(e)};this.YINTIF.methods.share=function(){YServices.core.require("shares",function(){YEXTIF.execFct("incStat","share.point.yoono-button");YServices.shares.startSharing(a.getId(),null,null,true)})};this.YINTIF.methods.logout=function(){a.signIn_disableSidebar()};this.YINTIF.methods.addToMemo=function(f,g){var e=a.callYoodget("sidebar","{memo@yoono.com}",-1,"addToMemo",[f,g])};this.serverUrl="";this.languages=new Object();this.lastDragOverTarget=null;this.yoodgetListElt=$("yoodgetlist");this.yoodgetListElt.innerHTML="";this.template=$("yoodgetwrapper-template");var d=window.location.href;this.rootUrl=d.substr(0,d.lastIndexOf("/"))+"/";this.sidebarUrl=this.rootUrl;this.yoodgetInstances=new Object();this.previouslyOpened=new Array();this.visibleWrappers=new Array();this._contextualMenu=null;this.thinContainer=$("thinyoodgetcontainer");this.thinContainer.innerHTML="";this.largeWidth=this.getKeyValue("LargeWidth");if(!this.largeWidth||this.largeWidth==0){this.largeWidth=267}this.thinModeThreshold=170;this.thinWidth=31;this.showOne=false;Sidebar.Mode={THIN:"thin",LARGE:"large"};this._displayMode=null;var c=this.getKeyValue("DisplayMode");this.firstReleaseRun=this.getKeyValue("FirstReleaseRun")||false;if(this.firstReleaseRun||(c!=Sidebar.Mode.THIN)){this.setLarge()}else{this.setThin(false)}this.showSearchbar(YEXTIF.execFct("getPref","show-searchbar"));this.shortcuts=new Array();if(Prototype.Browser.IE){Event.observe(document.body,"mouseover",function(e){a.stopGoingThin(e)});Event.observe(document.body,"mouseout",function(e){a.startGoingThin(e)});document.onselectstart=function(){var e=window.event.srcElement;return true}}if(!Prototype.Browser.IE){Event.observe(document.body,"dragover",function(e){nsDragAndDrop.dragOver(e,ynSidebar.dndObserver)},false);Event.observe(document.body,"dragdrop",function(e){nsDragAndDrop.drop(e,ynSidebar.dndObserver)},false)}else{yoono.event.addEventListener(document.body,"dragenter",function(e){YServices.log.debug("dragenter:"+$(e.srcElement).inspect());e.returnValue=false},true);yoono.event.addEventListener(document.body,"dragover",function(f){f.returnValue=false;var g=f.srcElement;var e=false;do{if(!("getAttribute" in g)){continue}e=g.getAttribute("onDropMethod")||false}while(!e&&(g=g.parentNode));if(!e){f.returnValue=true}else{f.returnValue=false;if("showOnlyOneYoodget"==e){if(g!=ynSidebar.lastDragOverTarget){ynSidebar.lastDragOverTarget=g;ynSidebar.showOnlyOneYoodget(g)}}else{ynSidebar.lastDragOverTarget=g}}},true)}this.deleteCommonKeyValue("overlayZIndex")}Sidebar.prototype.DO_NOT_PIN=true;Sidebar.prototype.SIDEBAR_RESIZED="SIDEBAR_SIDEBAR_RESIZED";Sidebar.prototype.YOODGET_PINNED_UP="SIDEBAR_YOODGET_PINNED_UP";Sidebar.prototype.YOODGET_PINNED_DOWN="SIDEBAR_YOODGET_PINNED_DOWN";Sidebar.prototype.YOODGET_RESIZED="SIDEBAR_YOODGET_RESIZED";Sidebar.prototype.YOODGET_REMOVED="SIDEBAR_YOODGET_REMOVED";Sidebar.prototype.YOODGET_EXPANDED="SIDEBAR_YOODGET_EXPANDED";Sidebar.prototype.YOODGET_REDUCED="SIDEBAR_YOODGET_REDUCED";Sidebar.prototype.YOODGET_ADDED="SIDEBAR_YOODGET_ADDED";Sidebar.prototype.YOODGET_MOVED="SIDEBAR_YOODGET_MOVED";Sidebar.prototype.setPhotoBgPosn=function(){YServices.skin.applyPhotoBgPosnToDocument(document)};Sidebar.prototype.setSkin=function(b){YServices.skin.applyToDocument(document,b);this.skin=b;var c=$(ynSidebar.yoodgetListElt).select(".yoodgetwrapper");var d=null;for(var a=0;a<c.length;a++){d=c[a].yoodgetWrapper;d.yoodget.setSkin(this.skin)}};Sidebar.prototype.setTextSize=function(e,b){var a=this;if(!b){setTimeout(function(){a.setTextSize(e,true)},10);return}YServices.skin.applyTextSizeToDocument(document,e);this.textSize=e;var d=$(ynSidebar.yoodgetListElt).select(".yoodgetwrapper");var f=null;for(var c=0;c<d.length;c++){f=d[c].yoodgetWrapper;f.yoodget.setTextSize(e)}};Sidebar.prototype.skinPhotoChanged=function(){this.setSkin(this.skin)};Sidebar.prototype.dndObserver={getSupportedFlavours:function(){var a=new FlavourSet();a.appendFlavour("text/unicode");a.appendFlavour("video");a.appendFlavour("text/html");return a},onDragOver:function(b,e,d){var c=b.target;var a=false;do{if(!("getAttribute" in c)){continue}a=c.getAttribute("onDropMethod")||false}while(!a&&(c=c.parentNode));if(!a){d.canDrop=false}else{d.canDrop=true;if("showOnlyOneYoodget"==a){if(c!=ynSidebar.lastDragOverTarget){ynSidebar.lastDragOverTarget=c;ynSidebar.showOnlyOneYoodget(c)}}else{ynSidebar.lastDragOverTarget=c}}},onDrop:function(i,j,h){var d=j.data;var g=i.target;g=$(g);var a=ynSidebar.lastDragOverTarget.getAttribute("onDropMethod");var b=h.sourceNode;if(a&&a in ynSidebar){YServices.log.debug("DROPPED "+d+" on "+g.className+" for "+a);try{var c=YTools.formatDroppedMessage(b,d);ynSidebar[a](i,b,g,d,c)}catch(f){YServices.log.error("Sidebar.onDropMethod for "+a+": "+f)}}else{YServices.log.error("Sidebar.dndManager.onDrop : method "+a+" not in yoodget "+yoodget.name)}},onDropIE:function(a,c){try{var f=ynSidebar.YEXTIF.execFct("getDragElement");var d=a.dataTransfer.getData("Text");var h=a.srcElement;try{var b=YTools.formatDroppedMessage(f,d);ynSidebar[c](a,f,h,d,b)}catch(g){YServices.log.error("Sidebar.onDropMethod for "+c+": "+g)}}catch(g){}}};Sidebar.prototype.init=function init(){var b=this.getKeyValue("UpdatedFrom")||"";var a=true;if(b){a=false}if(a){this.userDisplayedSeveralWidgetsYet()}YTools.addStatIframe("sidebar");if(YTools.isMac()){yoono.dom.addClassName(document.body,"mac")}if(Prototype.Browser.IE){yoono.dom.addClassName($(document.body),"ie")}yoono.dom.addClassName(document.body,"anonymousaccount");this.serverUrl=this.YEXTIF.execFct("getPref","serverurl");this.version=this.YEXTIF.execFct("getVersion");this.locale=YServices.env.getLocale();yoono.dom.addClassName(document.body,this.locale);if("YLanguages" in window){this.languages=window.YLanguages}YTools.initHover();YTools.initTooltips(this.languages);yoono.localization.translateDocument(document,this.languages);this._searchBar=new SearchBar().init(this._searchContainer,{_sidebar:this,onSearchStringChanged:function(e){if(e==""){e=null}if(e!=null){var d="http://www.oneriot.com/search?ot=REALTIME&q=";var g="&spid=a90d3bf6-3b28-43fd-8a03-b4d5cac44856";var f=e.replace(/(?:^\s+)|(?:\s+$)/,"").replace(/\s+/,"+");var c=d+f+g;this._sidebar.YEXTIF.execFct("openUrl",[c,"new-tab"])}}},yoono.localization.translate("Real-time web search...",this.languages),true);this.setSkin(YServices.skin.getSkin());this.setTextSize(YServices.skin.getTextSize());this._contextualMenu=new ContextualMenu();this.checkLoginFromCredentials();document.body.style.display=""};Sidebar.prototype.setId=function setId(a){this._id=a};Sidebar.prototype.getId=function getId(){return this._id};Sidebar.prototype.setWindowId=function setWindowId(a){this._windowId=a};Sidebar.prototype.getWindowId=function getWindowId(){return this._windowId};Sidebar.prototype.getLogin=function getLogin(){return(this.userCredential.login)};Sidebar.prototype.checkLoginFromCredentials=function checkLoginFromCredentials(){this.userCredential=this.YEXTIF.execFct("getUserCredential");if(!this.userCredential){this.createAnonymousAccount();return}if(this.userCredential.anonymous){this.checkLogin(this.userCredential.userId,null);return}yoono.dom.removeClassName(document.body,"noaccount");if(!this.userCredential.anonymous){yoono.dom.removeClassName(document.body,"anonymousaccount");if(!this.userCredential.password){this.signIn_display_signInPane();return}}this.checkLogin(this.userCredential.userId,null)};Sidebar.prototype.toggleForgotForm=function toggleForgotForm(){if(this.forgotFormElt.visible()){yoono.dom.hide(this.forgotFormElt)}else{yoono.dom.show(this.forgotFormElt)}};Sidebar.prototype.sendRegistrationStat=function sendRegistrationStat(b){var c=Prototype.Browser.IE?"ie":"ff";var a=this.getKeyValue("MarketingCampaign")||0;if(a){var d=a+"-"+b+"-"+c;YServices.ajax.request("http://api.yoono.com/rest/counters/one/campaign/"+d,"POST",{},{},null,null,function(){},function(){})}};Sidebar.prototype.checkLogin=function checkLogin(f,e){YServices.log.debug("checkLogin");if(e){if(!(Event.KEY_RETURN==e.keyCode)){return}}this.loginTryCounter++;if(!f){var c=YTools.getFieldValue($("signin-pane-login"));var d=YTools.getFieldValue($("signin-pane-password"));if(!(c.length*d.length)){this.signIn_display_errorMessage(null,"signin-pane-signin-errormsg","Please type your password");return}f=c+":"+d;this.userCredential.login=c;this.userCredential.password=d;this.userCredential.userId=f;this.userCredential.anonymous=false;$("signin-pane-password").value=""}var b='<server-script version="1.0">\n <context>\n <user-id>'+YTools.escapeXML(f)+"</user-id>\n </context>\n <get-user-data/>\n</server-script>";yoono.dom.addClassName(document.body,"logging-in");this.signIn_busyfy();var a=this;YServices.ajax(this.serverUrl+"linkserver",{method:"post",parameters:"script="+encodeURIComponent(b),onSuccess:function(g){a.checkLoginResult(g)},onFailure:function(g){a.requestFailure(g)}})};Sidebar.prototype.requestFailure=function requestFailure(a){yoono.dom.removeClassName(document.body,"logging-in");this.signIn_unbusyfy();YServices.log.debug("checkLogin:requestFailure");if(a&&a.responseText){YServices.log.error("Sidebar.requestFailure : request error "+a.responseText)}this.signIn_display_signInPane()};Sidebar.prototype.checkLoginResult=function checkLoginResult(e){if(e.responseXML==null||e.responseXML.documentElement==null){this.requestFailure(e);return}this.signIn_unbusyfy();YServices.log.debug("checkLogin:checkLoginResult");var d=e.responseXML.documentElement;var b=d.getElementsByTagName("import-user-data");var a=d.getElementsByTagName("display-error");yoono.dom.removeClassName(document.body,"logging-in");if(b&&b[0]){this.YEXTIF.execFct("setUserId",this.userCredential.userId);if(YServices.accountsManager){YServices.accountsManager.onPostLoginInit(YServices.accountsManager.YOONO_USER_SIGNED_IN,null)}this.signIn_enableSidebar_callback(true);return}if(a&&a[0]){var c=a[0].getAttribute("code");if("ERROR_INVALID_USER_ID"==c){if(this.loginTryCounter>1){this.signIn_display_errorMessage(null,"signin-pane-signin-errormsg","Login or password is invalid")}}else{this.signIn_display_errorMessage(null,"signin-pane-signin-errormsg","An error occured. Please try again")}}else{this.signIn_display_errorMessage(null,"signin-pane-signin-errormsg","An error occured. Please try again")}yoono.dom.addClassName(document.body,"loginrequired");this.loginRequired=true;this.signIn_display_signInPane()};Sidebar.prototype.createAnonymousAccount=function createAnonymousAccount(){this.sendRegistrationStat("newuser");this.YEXTIF.logDebug("Sidebar.createAnonymousAccount : requesting new Id");try{this.signIn_busyfy();var c=YEXTIF.execFct("getVersion");var b=YEXTIF.execFct("getClientType");var d='<server-script version="1.0">';var f=this.serverUrl+"linkserver";d+=" <create-anonymous-user></create-anonymous-user>";d+=" <context><version>"+c+"</version><client>"+b+"</client> </context> </server-script>";var a=this;YServices.ajax(f,{method:"post",parameters:"script="+encodeURIComponent(d),onSuccess:function(e){a.signIn_unbusyfy();a.YEXTIF.logDebug("Sidebar.createAnonymousAccount response : "+e.responseText);a.handleNewAnonymousUser(e)},onFailure:function(e){a.signIn_unbusyfy();a.requestFailure(e)}})}catch(g){this.signIn_unbusyfy();this.YEXTIF.logError("Sidebar.createAnonymousAccount:"+g)}};Sidebar.prototype.handleNewAnonymousUser=function handleNewAnonymousUser(h){var b=false;try{if(h.responseXML==null||h.responseXML.documentElement==null){this.requestFailure(h)}else{var f=h.responseXML.documentElement;var d=f.getElementsByTagName("display-message");if(d&&d[0]){var a=d[0].getAttribute("code");if("MSG_WELCOME_NEW_USER"==a){this.setKeyValue("CreateDate",new Date().getTime());b=true;var g=f.getElementsByTagName("user-id");if(g&&g[0]){this.userCredential=new Object();this.userCredential.login="";this.userCredential.password="";this.userCredential.anonymous=true;this.userCredential.userId=yoono.dom.XMLHelper.getInnerValue(g[0])}else{this.requestFailure(h);b=false}}}else{this.requestFailure(h)}}if(b){this.YEXTIF.execFct("setKeyValue",["wizardCreateDate",new Date().getTime()]);this.YEXTIF.execFct("setUserId",this.userCredential.userId);this.showSidebar(false)}}catch(c){this.YEXTIF.logError("Sidebar.handleNewAnonymousUser:"+c+":"+c.stack);this.requestFailure(h)}};Sidebar.prototype.showSidebar=function showSidebar(c){yoono.dom.removeClassName(document.body,"loginrequired");var a=this;this.loginRequired=false;try{Event.observe(document.body,"click",function(d){d=d||window.event;YTools.menuHide(d);var e=d.target||d.srcElement;if(e.id!="thin-btn-config"&&a.thinContextMenu){a.thinContextMenu.close()}});if(YServices.messenger){YServices.messenger.onMessengerAvailable(this)}if(!this.isThin()){this.checkIsRookie()}else{this.YEXTIF.execFct("incStat","sidebar.mode.thin")}this.initYoodgets(c)}catch(b){YServices.log.error("YoodgetWrapper.showSidebar : "+b);YServices.log.exception(b)}};Sidebar.prototype.checkIsRookie=function checkIsRookie(){var a=this.getKeyValue("DayLaunchCount");var c=false;var b=this.getCurrentDay();if(a){if(b!=a.day){a.day=b;a.counter+=1;c=true}}else{a={day:b,counter:0};c=true}if(a.counter<this.rookieDuration){yoono.dom.addClassName(document.body,"rookiemode")}if(c){this.setKeyValue("DayLaunchCount",YServices.json.encode(a))}};Sidebar.prototype.getCurrentDay=function getCurrentDay(){var c=new Date();var b=c.getMonth()+1;var f="";if(b<9){f="0"}b=f+b;f="";var e=c.getDate();if(e<9){f="0"}e=f+e;var a=c.getFullYear()+b+e;return(a)};Sidebar.prototype.notifyMessengerAvailable=function notifyMessengerAvailable(){YServices.messenger.cancelOnMessengerAvailable(this);this.messenger=YServices.messenger.getMessenger()};Sidebar.prototype.getCurrentUrl=function getCurrentUrl(){var a="";a=YServices.browser.getCurrentUrl(this.getId());var b=a.lastIndexOf("#");if(-1!=b){a=a.substring(0,b)}return(a)};Sidebar.prototype.getRegisteredYoodget=function getRegisteredYoodget(b,a){var c=this.getRegisteredYoodgetWrapper(b,a);if(c){return(c.yoodget)}else{return(null)}};Sidebar.prototype.getRegisteredYoodgetWrapper=function getRegisteredYoodgetWrapper(b,a){var c=YServices.yoodgetInstances.getRegisteredYoodgetWrapper(b,a);return(c)};Sidebar.prototype.userConnected=function userConnected(){this.userCredential=this.YEXTIF.execFct("getUserCredential");yoono.dom.removeClassName(document.body,"anonymousaccount");this.callYoodget("sidebar","{memo@yoono.com}",-1,"userSignedIn",[]);this.callYoodget("sidebar","{friends@yoono.com}",-1,"userSignedIn")};Sidebar.prototype.isYoodgetPresent=function isYoodgetPresent(b){var a=false;if((b in this.yoodgets)&&this.yoodgets[b]){a=true}return(a)};Sidebar.prototype.callYoodget=function callYoodget(g,k,j,a,f){var l=null;var b="";try{var i=null;i=this.getRegisteredYoodgetWrapper(k,j);if(i){var d=false;var c=i.yoodget;if(a in c.TYPIF.methods){b=this.pkToYuid(g);if(a in c.TYPIF.auth){if(b&&(b in c.TYPIF.auth[a])){d=true}else{YServices.log.error("YoodgetWrapper.callYoodget : Yoodget "+b+" is not authorized to call "+a+" on yoodget "+k);alert("YoodgetWrapper.callYoodget : Yoodget "+b+" is not authorized to call "+a+" on yoodget "+k)}}else{d=true}if(d){if(!f){f=new Array()}f.unshift(b);l=c.TYPIF.methods[a](f)}}}else{YServices.log.error("Sidebar.callYoodget : yoodget "+k+" is not available")}}catch(h){YServices.log.error("Sidebar.callYoodget : "+h+" "+h.stack)}return(l)};Sidebar.prototype.pkToYuid=function(b){if("sidebar"==b){return("sidebar")}if("extension"==b){return("extension")}var a=YServices.yoodgetInstances.pkToYuid(b);return(a)};Sidebar.prototype.close=function close(){var a=this.getKeyValue("firstCloseDone");if(!a){var b='<div style="text-align:center;font-size:20px">'+this.translateText("To open the sidebar again, click on the Yoono button or use the View/Sidebar menu of Firefox")+"</div>";b+='<div style="text-align:center;font-size:12px"><br>'+this.translateText("Click on the page to close this message, or just wait...")+"</div>";setTimeout(function(){yoono.require("yoono.messages");yoono.messages.centeredMsg({templateData:{text:b}})},100)}this.setKeyValue("firstCloseDone",true);this.YEXTIF.execFct("closeSidebar")};Sidebar.prototype.resizeHandler=function resizeHandler(b){if(!document.all){var c=Event.element(b);if(c.document.location.href!=document.location.href){return}}var a=this;clearTimeout(this.resizeTimer);this.resizeTimer=setTimeout(function(){a.sizeRefreshed()},50)};Sidebar.prototype.sizeRefreshed=function sizeRefreshed(){clearTimeout(this.resizeTimer);if(YServices.adManager){YServices.adManager.fixLayout(this.getId(),YServices.adManager.AREA_SIDEBAR_BOTTOM_BANNER)}this.fixLayout(Sidebar.prototype.SIDEBAR_RESIZED,null);this.saveYoodgetOnTimer()};Sidebar.prototype.checkEmptyness=function checkEmptyness(b){var a=false;var c=this.yoodgetListElt.select(".yoodgetwrapper");if(!c||!c.length){if(b){document.body.addClassName("empty")}a=true}else{document.body.removeClassName("empty")}return(a)};Sidebar.prototype.setKeyValue=function setKeyValue(a,b){this.YEXTIF.execFct("setKeyValue",["sidebar"+a,b])};Sidebar.prototype.getKeyValue=function getKeyValue(a){return(this.YEXTIF.execFct("getKeyValue","sidebar"+a))};Sidebar.prototype.deleteKeyValue=function deleteKeyValue(a){this.YEXTIF.execFct("deleteKeyValue","sidebar"+a)};Sidebar.prototype.sanitizeCommonKey=function sanitizeCommonKey(a){var b="{common}"+a;return(b)};Sidebar.prototype.setCommonKeyValue=function setCommonKeyValue(a,b){b=b||"";var c=this.sanitizeCommonKey(a);this.YEXTIF.execFct("setKeyValue",[c,b])};Sidebar.prototype.getCommonKeyValue=function getCommonKeyValue(a){var b=this.sanitizeCommonKey(a);return(this.YEXTIF.execFct("getKeyValue",b))};Sidebar.prototype.deleteCommonKeyValue=function deleteCommonKeyValue(a){var b=this.sanitizeCommonKey(a);return(this.YEXTIF.execFct("deleteKeyValue",b))};Sidebar.prototype.initYoodgets=function initYoodgets(j){try{if(this.signIn_isSidebarDisabled()){this.signIn_display_signInPane();return}var c=[];if(j){c=this.getKeyValue("YoodgetList")||[]}var g=new Object();var l=new Object();var k=new Object();k["recos/index.html"]={url:"discoveries/index.html",yuid:"{discoveries@yoono.com}"};k["photos/index.html"]={url:"discoveries/index.html",yuid:"{discoveries@yoono.com}"};k["videos/index.html"]={url:"discoveries/index.html",yuid:"{discoveries@yoono.com}"};k["gmail/index.html"]={url:"mail/index.html",yuid:"{mail@yoono.com}"};k["friends/index.html"]={url:"friends2/index.html",yuid:"{friends@yoono.com}"};var f=false;for(var h=0;h<c.length;h++){try{if("{suggestions@yoono.com}"==c[h].yuid){c[h].yuid="{discoveries@yoono.com}"}if(c[h].url in k){var a=c[h].url;c[h].url=k[a].url;c[h].yuid=k[a].yuid}if(c[h].yuid in g){continue}if(c[h].url in l){continue}g[c[h].yuid]=true;c[h].delay=h*500;if(f&&!this.hasUserDisplayedSeveralWidgetsYet()){c[h].pinnedDown=false}this.addYoodget(c[h],false,c[h].multiple);if(c[h].pinnedDown){f=true}}catch(d){YServices.log.error("Sidebar.initYoodgets: Failed to add Yoodget for "+c[h].url+" : "+d)}}var b=this.checkEmptyness(false);var i=this.YEXTIF.execFct("getPref","release");if(b||(this.firstReleaseRun&&(i<="6.0.0"))){this.getDefaultYoodgets(b)}if(!this.isThin()&&!this.showOne){this.YEXTIF.execFct("incStat","sidebar.mode.dual")}this.yoodgetInitialized=true;this.fixLayout(Sidebar.prototype.SIDEBAR_RESIZED,null)}catch(d){YServices.log.error("Sidebar.initYoodgets : "+d)}};Sidebar.prototype.getDefaultYoodgets=function getDefaultYoodgets(c){var a=this;var b=this.YEXTIF.execFct("getPref","autoinstall")||"full";var d={setYoodget:function(j){var e=yoono.dom.XMLHelper.parseFromString(j);var h=e.documentElement;var i=h.getElementsByTagName("yoodget")||[];for(var k=0;k<i.length;k++){var f=i[k].getAttribute("autoinstall")||"";var l=i[k].getAttribute("yuid");var m=i[k].getAttribute("multiple")||"false";if("true"!=m){var g=a.isYoodgetPresent(l);if(g){continue}}if(f.indexOf(b)!=-1){a.addYoodgetFromXml(i[k],false,c)}}}};this.YEXTIF.execFct("getYoodgets",[d])};Sidebar.prototype.hasUserDisplayedSeveralWidgetsYet=function hasUserDisplayedSeveralWidgetsYet(){return(this.getKeyValue("SeveralWidgetsOk")||false)};Sidebar.prototype.userDisplayedSeveralWidgetsYet=function userDisplayedSeveralWidgetsYet(){this.setKeyValue("SeveralWidgetsOk",true)};Sidebar.prototype.getWrappers=function getWrappers(c){var b=new Array();var d=Element.select(document,".yoodgetwrapper");var a;d.each(function(e){if(!e.yoodgetWrapper){return null}a=e.yoodgetWrapper.url+"&Yinst="+e.yoodgetWrapper.instance;if(!c||(c==a)){b.push(e.yoodgetWrapper)}});return b};Sidebar.prototype.remoteYoodget=function remoteYoodget(a){return((a.indexOf("http://")==0)||(a.indexOf("https://")==0))};Sidebar.prototype.saveConfig=function saveConfig(){this.setKeyValue("LargeWidth",this.largeWidth);this.setKeyValue("DisplayMode",this._displayMode);this.saveYoodgets()};Sidebar.prototype.saveYoodgetOnTimer=function saveYoodgetOnTimer(){if(this.isClosing){return}try{clearTimeout(this.saveYoodgetsTimeout);var a=this;this.saveYoodgetsTimeout=setTimeout(function(){a.saveYoodgets()},2000)}catch(b){}};Sidebar.prototype.saveYoodgets=function saveYoodgets(){if(!this.yoodgetInitialized||this.getKeyValue("sidebarDisabled")===true){return}YServices.log.debug("Saving sidebar composition");try{var f=new Array();var c=this.yoodgetListElt.select(".yoodgetwrapper");var g=null;var a=null;for(var b=0;b<c.length;b++){g=c[b].yoodgetWrapper;a=new YoodgetInfo(g,null);if(!a.yuid){return}if(g.thinWrapperElt){if(g.isPinnedDown()){a.pinnedDown=true}}f.push(a)}this.YEXTIF.execFct("setStat",["widget.number",f.length]);this.setKeyValue("YoodgetList",YServices.json.encode(f))}catch(d){YServices.log.error("Sidebar.saveYoodgets "+d)}YServices.log.debug("Sidebar composition saved")};Sidebar.prototype.setSortable=function setSortable(){Position.includeScrollOffsets=true;var a="ywicon-thin-container";var b=0;if(Prototype.Browser.IE){b=100}Sortable.create("thinyoodgetcontainer",{delay:b,scroll:"true",tag:"div",handle:a,ghosting:false,constraint:"vertical",onChange:ynSidebar.changeSortable,onUpdate:ynSidebar.updateSortable})};Sidebar.prototype.changeSortable=function changeSortable(a){window.ynSidebar._draggingThinIcons=new Date();YServices.log.debug("CHANGE SORTABLE : "+a.id)};Sidebar.prototype.updateSortable=function updateSortable(a){ynSidebar.updateYoodgetPositions();ynSidebar.refreshVisibleWrapperList();YServices.log.debug("UPDATE SORTABLE : "+a.id);window.ynSidebar._draggingThinIcons=new Date()};Sidebar.prototype.updateYoodgetPositions=function updateYoodgetPositions(){var b=this.thinContainer.childNodes;for(var a=0;a<b.length;a++){this.yoodgetListElt.appendChild(b[a].wrapperElt)}};Sidebar.prototype.checkInstalledFromXml=function checkInstalledFromXml(c){var b=c.getAttribute("yuid");var a=-1;var d=null;d=this.getRegisteredYoodgetWrapper(b,a);if(d){return true}else{return false}};Sidebar.prototype.addYoodgetFromXml=function addYoodgetFromXml(b,e,d){clearTimeout(this._addWidgetTimer);var c=new Object();c.url=b.getAttribute("url");c.yuid=b.getAttribute("yuid");c.order=b.getAttribute("order")||50;if(d){c.pinnedDown=true}else{c.pinnedDown=false}c.view="block";c.instance=-1;c.multiple="true"==b.getAttribute("multiple");c.minHeight=b.getAttribute("minHeight");c.maxHeight=b.getAttribute("maxHeight");this._widgetsToAdd.push(c);var a=this;if(e){if(d){this.hideOtherYoodgets()}return(this.addYoodget(c,d,c.multiple))}else{this._addWidgetTimer=setTimeout(function(){a.sortAndAddYoodgets(d)},150)}};Sidebar.prototype.sortAndAddYoodgets=function sortAndAddYoodgets(b){this._widgetsToAdd.sort(function(d,c){return(d.order>c.order)});var a=null;while(a=this._widgetsToAdd.pop()){if(b){this.hideOtherYoodgets()}this.addYoodget(a,b,a.multiple)}this._addWidgetTimer=null};Sidebar.prototype.addYoodget=function addYoodget(b,c,h){try{if(("string"==typeof(b))){b=YServices.json.decode(b)}var d=null;var a=b.url;var j=b.yuid;var g=b.view;var i=b.instance;if(!(j in this.yoodgets)){this.yoodgets[j]=0}this.yoodgets[j]++;if((a.indexOf("http://")==0)||(a.indexOf("chrome://yoonosb/content/external/")==0)){d=new SafeYoodgetWrapper()}else{d=new YoodgetWrapper()}d.init(this,b,c);if((("pinnedDown" in b)&&b.pinnedDown)){d.pinDown()}else{d.hide()}}catch(f){YServices.log.error("Sidebar.addYoodget: Failed to create YoodgetWrapper for "+a+" : "+f.stack+f.message)}this.refreshVisibleWrapperList();this.checkEmptyness(true);return(true)};Sidebar.prototype.addYoodgetFriends=function addYoodgetFriends(){this.hideOtherYoodgets();var a=Object();a.url="friends2/index.html";a.yuid="{friends@yoono.com}";a.pinnedDown=true;a.needsId=false;a.view="block";a.instance=-1;a.multiple=false;this.addYoodget(a,true,false)};Sidebar.prototype.showManageBookmarks=function showManageBookmarks(){if(this.loginRequired){return}try{var a="pops/bookmarks/index.html";a=this.rootUrl+a;var c=new Object();c.width=300;c.height=440;c.titlebar="no";c.toolbar="no";c.status="no";c.chrome="yes";c.resizable="no";c.alwaysRaised=1;c.centerscreen="yes";this.YEXTIF.execFct("popup",[this,a,"bookmarks",c])}catch(b){YServices.log.error("Sidebar.showManageBookmarks: "+b)}};Sidebar.prototype.showConfig=function showConfig(c,a){if(this.loginRequired){return}try{if(!c){c="widgets"}var b="configPop.html?tab="+c+"&y="+(a||"");b=this.rootUrl+b;var f=new Object();if(c=="signin"||c=="register"){f.width=460;f.height=400}else{f.width=630;f.height=467}f.titlebar="no";f.toolbar="no";f.status="no";f.chrome="yes";f.resizable="no";f.alwaysRaised=1;f.centerscreen="yes";var g=null;this.configPop=this.YEXTIF.execFct("popup",[this,b,"config",f])}catch(d){YServices.log.error("Sidebar.showConfig: "+d)}};Sidebar.prototype.singletonPopup=function singletonPopup(g,f,d){try{var a=this;var b=this.YEXTIF.execFct("singletonPopup",[a,g,f,d])}catch(c){YServices.log.error("YoodgetWrapper.singletonPopup: "+c)}};Sidebar.prototype.singletonPopupSetWindow=function singletonPopupSetWindow(a){this.thinContextMenu=a};Sidebar.prototype.mouseOutPopup=function mouseOutPopup(b,a){var c=a.target;this.singletonPopupTimer=setTimeout(function(){b.close()},500)};Sidebar.prototype.mouseOverPopup=function mouseOverPopup(){clearInterval(this.singletonPopupTimer)};Sidebar.prototype.getResizeWidth=function getResizeWidth(c,b){var a=c;if(c>this.thinModeThreshold/2){this.largeWidth=c;this.setLarge();a=Math.max(c,this.thinModeThreshold)}else{this.setThin(false);a=this.thinWidth}YServices.observer.notifyObservers("sidebar.resized",{width:a,direction:b});return a};Sidebar.prototype.isThin=function isThin(){return(this._displayMode==Sidebar.Mode.THIN)};Sidebar.prototype.isShowOne=function isShowOne(){return(this.showOne)};Sidebar.prototype.toggleDisplayMode=function toggleDisplayMode(){this.showOne=false;if(this._displayMode==Sidebar.Mode.THIN){this.setLarge();if(!this.pinnedDownYoodgets()){var b=this.thinContainer.select(".thinyoodget");if(b&&b[0]){var a=b[0];this.showOnlyOneYoodget(a)}}}else{return this.setThin(false)}};Sidebar.prototype.setLarge=function setLarge(){if(YServices.activityChronos){YServices.activityChronos.gotActivity("sidebar")}if(this._displayMode==Sidebar.Mode.LARGE){return}this.YEXTIF.execFct("incStat","sidebar.mode.dual");if(YServices.adManager){YServices.adManager.subscribe(this,this.getId(),document,[YServices.adManager.AREA_SIDEBAR_BOTTOM_BANNER])}try{var d=this.largeWidth;if(d<this.thinModeThreshold){d=this.thinModeThreshold}this.YEXTIF.execFct("setLarge",d);this._displayMode=Sidebar.Mode.LARGE;var c=null;if(!this.showOne){var h=this.thinContainer.select(".pinneddown");var g=null;var a=null;for(var b=0;b<h.length;b++){g=this.getWrapperFromThinWrapperElt(h[b]);a=g.getDomElt();yoono.dom.removeClassName(a,"wrapperhidden");g.setLarge()}}yoono.dom.addClassName(document.body,"showboth");yoono.dom.removeClassName(document.body,"showthin")}catch(f){YServices.log.exception(f)}};Sidebar.prototype.setThin=function setThin(e,d){this.lastDragOverTarget=null;if(e){this.largeWidth=(Prototype.Browser.IE)?(document.body.offsetWidth):(document.body.clientWidth)}if(this._displayMode==Sidebar.Mode.THIN){return}if(YServices.adManager){YServices.adManager.unSubscribe(this.getId())}this._displayMode=Sidebar.Mode.THIN;if(!d){this.YEXTIF.execFct("setThin",this.thinWidth)}var b=[];var c=this.thinContainer.select(".thinyoodget");var a;for(var f=0;f<c.length;f++){a=c[f];var h=this.getWrapperFromThinWrapperElt(a);if(h.isPinnedDown()){var g=a.wrapperElt.yoodgetWrapper.getYuidi();b.push(g)}a.wrapperElt.yoodgetWrapper.hide()}if(0!=b.length){this.previouslyOpened=b}yoono.dom.removeClassName(document.body,"showboth");yoono.dom.addClassName(document.body,"showthin")};Sidebar.prototype.showSearchbar=function showSearchbar(a){if(a){yoono.dom.addClassName(document.body,"show-searchbar")}else{yoono.dom.removeClassName(document.body,"show-searchbar")}};Sidebar.prototype.getShowSearchbar=function getShowSearchbar(){return yoono.dom.hasClassName(document.body,"show-searchbar")};Sidebar.prototype.finalize=function finalize(){if(YServices.adManager){YServices.adManager.unSubscribe(this.getId())}if(this.configPop){this.configPop.close()}if(YServices.messenger&&YServices.messenger.getExistingMessenger()){YServices.log.debug("Unload messenger!");YServices.messenger.getExistingMessenger().unload()}};Sidebar.prototype.mouseOut=function mouseOut(){if(this.showOne&&!this.pinnedDownYoodgets()&&!this.checkEmptyness(true)){this.setThin(false);this.showOne=false;this.YEXTIF.execFct("incStat","sidebar.mode.thin")}};Sidebar.prototype.startGoingThin=function startGoingThin(){if(!this.showOne){return}try{var a=this;if(window.popupTimer){clearInterval(window.popupTimer)}window.popupTimer=setTimeout(function(){a.mouseOut()},100)}catch(b){alert("startClosing :"+b)}};Sidebar.prototype.stopGoingThin=function stopGoingThin(){if(!this.showOne){return}try{if(window.popupTimer){clearInterval(window.popupTimer)}}catch(a){alert("stopClosing :"+a)}};Sidebar.prototype.showMenu=function showMenu(a){a=a||window.event;var b=a.target||a.srcElement;this._menuYoodgetWrapper=this.getYoodgetWrapper(b);if(a.button==2){if(YTools.currentPop){YTools.currentPop.hide()}this._contextualMenu.hide();if(this.isThin()||!this._menuYoodgetWrapper){this.openContextMenuPop(a)}else{this.showYoodgetMenu(b,a,this._menuYoodgetWrapper.yoodget)}Event.stop(a)}else{if(b.id=="thin-btn-config"){this._menuYoodgetWrapper=this.visibleWrappers[0];if(this.isThin()||!this._menuYoodgetWrapper){this.openContextMenuPop(a)}else{this.showYoodgetMenu(b,a,this._menuYoodgetWrapper.yoodget)}Event.stop(a)}}};Sidebar.prototype.executeMenu=function executeMenu(a){a=a||window.event;var c=a.target||a.srcElement;var b=c.readAttribute("value");this.executeMenuValue(b)};Sidebar.prototype.executeMenuValue=function executeMenuValue(a,b){switch(a){case"config":this.showConfig("widgets");break;case"help":this.help();break;case"skin":YServices.skin.changeSkin(b);this.setSkin(b);break;case"text-size":YServices.skin.changeTextSize(b);this.setTextSize(b);break;case"minimizeSidebar":this.setThin();break;case"maximizeSidebar":this.setLarge();break;case"closeSidebar":this.close();break;case"signin":this.showConfig("signin");break;case"deactivate":this.signIn_disableSidebar();break}};Sidebar.prototype.getYoodgetWrapper=function getYoodgetWrapper(b){var a=b;if(!yoono.dom.hasClassName(b,"thinyoodget")){b=yoono.dom.up(b,"thinyoodget")}if(b&&b.wrapperElt&&b.wrapperElt.yoodgetWrapper){return b.wrapperElt.yoodgetWrapper}a=yoono.dom.up(a,"yoodgetwrapper");if(a){return a.yoodgetWrapper}return null};Sidebar.prototype.openContextMenuPop=function openContextMenuPop(h){var f=h.screenY-2;var b=h.screenX-2;var a="thinContextMenu.html";if(Prototype.Browser.IE){a=this.rootUrl+a}var d=Event.element(h);var i=YServices.skin.getTextSizeList();var c=YServices.skin.getTextSize();var j=i[c].menuHeight;if(!this.userCredential||this.userCredential.anonymous){j+=i[c].menuItemHeight}var g=new Object();g.height=j;g.width=230;g.resizable=0;g.menubar="no";g.chrome="yes";g.titlebar="no";g.centerscreen="no";g.alwaysRaised=1;g.popup=1;g.left=b;g.top=f;var e=this;this.thinContextMenu=this.YEXTIF.execFct("singletonPopup",[e,a,"thincontextmenu",g,d])};Sidebar.prototype.showYoodgetMenu=function showYoodgetMenu(h,n,l){if(this._contextualMenu.visible()){this._contextualMenu.hide();return}var g=this.YEXTIF.execFct("getUserCredential");var p=!g||g.anonymous;var o=this;var a=new Array();a.push({caption:o.translateText("Add Widget..."),action:function(){o.executeMenuValue("config")}});a.push({caption:o.translateText("Options..."),action:function(){l.showConfigPop(n)}});a.push({caption:o.translateText("Help"),action:function(){o.executeMenuValue("help")}});a.push({separator:true});a.push({caption:o.translateText("Minimize"),action:function(){o.executeMenuValue("minimizeSidebar")}});a.push({caption:o.translateText("Close"),action:function(){o.executeMenuValue("closeSidebar")}});if(p){a.push({caption:o.translateText("Register/Sign In..."),action:function(){o.executeMenuValue("signin")}})}a.push({caption:o.translateText("Sign Out..."),action:function(){o.executeMenuValue("deactivate")}});var q=YServices.skin.getSkinList();var f=0;var c="";for(var e in q){f++;var r=q[e];c+='<div class="menu-color-box" skin-id="'+e+'" style="background-color:'+r.bg+'" ></div>'}if(f>0){a.push({separator:true});a.push({content:c,action:function(j,s){var i=j.target||j.srcElement;o.executeMenuValue("skin",i.getAttribute("skin-id"))}})}var b="";var k=YServices.skin.getTextSizeList();for(var d in k){var m=k[d];b+='<div class="menu-text-size" text-size="'+m.css+'">'+this.translateText(m.name)+"</div>"}a.push({content:b,action:function(i,j){var s=i.target||i.srcElement;o.executeMenuValue("text-size",s.getAttribute("text-size"))}});l.getMenuEntries(a);this._contextualMenu.show(a,h,n)};Sidebar.prototype.help=function help(){this.YEXTIF.execFct("openUrl",["http://www.yoono.com/help.html","new-tab"])};Sidebar.prototype.hideOtherYoodgets=function hideOtherYoodgets(a){var b=this.thinContainer.select(".thinyoodget");for(var c=0;c<b.length;c++){if(b[c]!=a){var d=this.getWrapperFromThinWrapperElt(b[c]);if(d.isPinnedDown()){d.pinUp()}}}};Sidebar.prototype.showOnlyOneYoodget=function showOnlyOneYoodget(a){if(YServices.activityChronos){YServices.activityChronos.gotActivity("sidebar")}if(!a){return}this.hideOtherYoodgets(a);this._singleYoodgetWrapper=this.getWrapperFromThinWrapperElt(a);this._singleYoodgetWrapper.show();this._singleYoodgetWrapper.setFullHeight();if(!this.showOne){this.showOne=true}this.setLarge();this._singleYoodgetWrapper.pinDown();this.checkIsRookie()};Sidebar.prototype.getOffsetHeight=function getOffsetHeight(){var a=this.getVisibleWrappersHeight()-this.yoodgetListElt.clientHeight;if(Math.abs(a)<2){a=0}return(a)};Sidebar.prototype.getVisibleWrappersHeight=function getVisibleWrappersHeight(){var b=this.visibleWrappers.length;var c=0;for(var a=0;a<b;a++){c+=this.visibleWrappers[a].getHeight()+3}c-=3;return(c)};Sidebar.prototype.fixLayout=function fixLayout(b,c){var a=this;clearTimeout(this.fixLayoutTimer);this.fixLayoutTimer=setTimeout(function(){a.doFixLayout(b,c)},200)};Sidebar.prototype.doFixLayout=function doFixLayout(c,e){var f=this.visibleWrappers.length;var b=new Array();var d=0;var a=null;for(var h=0;h<f;h++){a=this.visibleWrappers[h];if(a==e){continue}var i=a.getHeight();b.push(a)}var g=f;if((0==b.length)&&f&&(e!=this.visibleWrappers[f-1])){b.push(this.visibleWrappers[f-1])}while((d=this.getOffsetHeight())&&(f=b.length)&&g--){this.resizeThem(d,b,f)}for(var h=0;h<b.length;h++){b[h].setWidth()}if(this.getOffsetHeight()&&e){this.doFixLayout(c,null)}this.yoodgetListElt.scrollTop=0};Sidebar.prototype.resizeThem=function resizeThem(e,d,f){var i=this.getVisibleWrappersHeight();var c=0;var b=null;var j=0;var a=0;var g=0;for(var h=0;h<f;h++){b=d[h];j=b.getHeight();g=j/i;c=Math.ceil(e*g);a=j-c;b.setHeight(a);if(a<30){d.splice(h,1);break}}};Sidebar.prototype.pinnedDownYoodgets=function pinnedDownYoodgets(){var a=this.thinContainer.select(".pinneddown");return(a.length)};Sidebar.prototype.refreshVisibleWrapperList=function refreshVisibleWrapperList(){this.visibleWrappers=new Array();var d=this.yoodgetListElt.childNodes;var c=null;for(var a=0;a<d.length;a++){c=d[a].yoodgetWrapper;yoono.dom.removeClassName(c.getDomElt(),"last-visible-wrapper");if(c.isPinnedDown()){c.setVisiblePosition(this.visibleWrappers.length);this.visibleWrappers.push(c)}}var b=this.visibleWrappers.length-1;if(b>=0){yoono.dom.addClassName(this.visibleWrappers[b].getDomElt(),"last-visible-wrapper")}};Sidebar.prototype.toggleYoodgetPin=function toggleYoodgetPin(b){if(window.ynSidebar._draggingThinIcons&&((new Date()-window.ynSidebar._draggingThinIcons)<1000)){return}YServices.log.debug("toggleYoodgetPin:"+new Date()+":"+window.ynSidebar._draggingThinIcons);b=b||window.evt;var d=Event.element(b);var a=yoono.dom.up(d,"thinyoodget");if(!a){return}var c=false;if(b){c=b.ctrlKey;if(b.metaKey){c=b.metaKey}}var e=this.getWrapperFromThinWrapperElt(a);if(e.isPinnedDown()){if(this.isThin()||(!c&&(this.pinnedDownYoodgets()>1))){if(this.isThin()){this.setLarge()}this.showOnlyOneYoodget(a)}else{e.pinUp();if(!this.pinnedDownYoodgets()){this.setThin()}}}else{if(!c){this.showOnlyOneYoodget(a)}else{e.pinDown();this.userDisplayedSeveralWidgetsYet()}this.setLarge()}this.saveYoodgets();this.refreshVisibleWrapperList()};Sidebar.prototype.getWrapperFromThinWrapperElt=function getWrapperFromThinWrapperElt(a){var b=a.wrapperElt.yoodgetWrapper;return(b)};Sidebar.prototype.showYoodget=function showYoodget(a){if(!a){return}var b=this.getWrapperFromThinWrapperElt(a);b.setView("block");if(b.isPinnedDown()){a.wrapperElt.scrollIntoView();return}b.pinDown();b.show()};Sidebar.prototype.removeYoodget=function removeYoodget(c,a){var d;d=this.getRegisteredYoodgetWrapper(c,a);if(d){d.close();this.yoodgets[c]--;if(!this.pinnedDownYoodgets()){var b=this.yoodgetListElt.childNodes[0];if(b){b.yoodgetWrapper.pinDown()}}this.refreshVisibleWrapperList()}};Sidebar.prototype.removeYoodgetWrapper=function removeYoodgetWrapper(a){if(a){a.close()}};Sidebar.prototype.translateText=function translateText(a){return yoono.localization.translate(a,this.languages)};Sidebar.prototype.translateTemplate=function translateTemplate(b,a){return yoono.localization.translateTemplateAndEval(b,a,this.languages)};Sidebar.prototype.shortcutClick=function shortcutClick(d,b){if(!YServices.accountsManager){var a=this;yoono.require("yoono.dialog");var c=new yoono.dialog.DialogCtrl(this.languages);c.setTitle("Share with your Friends!");c.setMessageIcon("warning");c.setMessage("In order to use Yoono's sharing feature you need to set up a social network.");c.addButton("add-bt","Add a social network",function(){a.addYoodgetFriends();c.close()});c.addButton("close-bt","Close",function(){c.close()});c.setWidth(340);c.setHeight(154);c.open();return}YServices.core.require("shares",function(){YEXTIF.execFct("incStat","share.point.thin-sidebar");YServices.shares.startSharing(this.getId(),b,null,true)}.bind(this))};Sidebar.prototype.switchToYoodget=function(b){var c=this.getRegisteredYoodgetWrapper(b,-1);if(c){var a=c.getThinWrapperElt();this.showOnlyOneYoodget(a,false);this.fixLayout(Sidebar.prototype.YOODGET_PINNED_DOWN)}};Sidebar.prototype.showFriendsAddService=function showFriendsAddService(){this.setLarge();var a=null;a=this.getRegisteredYoodgetWrapper("{friends@yoono.com}",-1);if(a){this.callYoodget("sidebar","{friends@yoono.com}",-1,"displayAddPanel",[])}else{this.addYoodgetFriends()}};Sidebar.prototype.shortcutDrop=function shortcutDrop(d,c,e,a,b){ynSidebar.lastDragOverTarget.shortcut.drop(d,c,e,a,b)};Sidebar.prototype.externalYoodgetDrop=function externalYoodgetDrop(f,e,g,c,d){if(e.nodeName!="IMG"){return}if(yoono.dom.hasClassName(e,"yoono-add-yoodget")){var b=Element.readAttribute(e,"yoodget");var a=this;YServices.ajax(b,{method:"get",onSuccess:function(i){if(i.responseXML!=null&&i.responseXML.documentElement!=null){a.addExternalYoodget(i.responseXML.documentElement)}}});return}if("video"==d.type){var h={url:"chrome://yoonosb/content/external/index.html",icon:"",title:"Set this in Prefs",code:d.text,instance:-1,top:20,left:20,width:200,height:350,minHeight:0,maxHeight:1600,yuid:"{external@yoono.com}",pinnedDown:true,view:"block"};this.addYoodget(h,true,true);this.setSortable()}};Sidebar.prototype.addExternalYoodget=function addExternalYoodget(f){var a=f.getAttribute("url")||"chrome://yoonosb/content/external/index.html";var m=f.getAttribute("yuid");var k=f.getAttribute("icon");var c=f.getElementsByTagName("embededCode");var b="";if(c&&c[0]){b=yoono.dom.getInnerText(c[0])}var h=f.getElementsByTagName("properties");var l="";var e="";for(var g=0;g<h.length;g++){var d=h[g].getAttribute("lang");if("en"==d){e=h[g].getAttribute("title")}if(this.locale==d){l=h[g].getAttribute("title")}}if(!l){l=e}var j={url:a,icon:k,title:l,code:b,instance:-1,top:20,left:20,width:200,height:350,minHeight:120,maxHeight:1600,yuid:m,pinnedDown:true,view:"block"};this.addYoodget(j,true,true);this.setSortable()};Sidebar.prototype.shareLinkClick=function shareLinkClick(c,a){var b;switch(a){case"twitter":b=ShareLinkBuilder.getTwitterLink(c);break;case"facebook":b=ShareLinkBuilder.getFacebookLink(c);break;case"friendfeed":b=ShareLinkBuilder.getFriendFeedLink(c);break}this.YEXTIF.execFct("openUrl",[b,"new-tab"])};function yoonoSidebarUnInit(){if(Prototype.Browser.IE){yoonoSidebarQuit()}}function yoonoSidebarInit(a){YServices.skin.applyToDocument(document,YServices.skin.getSkin());try{ynSidebar=new Sidebar(a);ynSidebar.init();setTimeout(function(){YServices.core.require(deferredServices,function(){if(YServices.adManager){YServices.adManager.subscribe(ynSidebar,ynSidebar.getId(),document,[YServices.adManager.AREA_SIDEBAR_BOTTOM_BANNER])}})},deferDelay)}catch(b){if(document.all){YServices.log.error("error in yoonoSidebarInit "+b+"\n"+b.stack)}else{YServices.log.exception(b)}return"error in yoonoSidebarInit"}return null}function yoonoSidebarQuit(){try{ynSidebar.isClosing=true;clearTimeout(ynSidebar.saveYoodgetsTimeout);ynSidebar.saveConfig();ynSidebar.setKeyValue("FirstReleaseRun",false);YServices.browser.notifySidebarClose(ynSidebar);ynSidebar.finalize();var b=$(ynSidebar.yoodgetListElt).select(".yoodgetwrapper");var d=null;for(var a=0;a<b.length;a++){d=b[a].yoodgetWrapper;d.close()}YServices.observer.notifyObservers("app.sidebar.quit",ynSidebar)}catch(c){YServices.log.exception(c)}}Sidebar.prototype.signIn_display_signInPane=function signIn_display_signInPane(){var b=yoono.dom.$("signin-pane");if(yoono.dom.visible(b)){return}yoono.dom.show(b);b.style.display="block";this.signIn_display_signinView();var a=this;setTimeout(function(){if(a.getKeyValue("sidebarDisabled")){yoono.dom.$("signin-pane-login").setAttribute("readonly",true);yoono.dom.$("signin-pane-password").focus()}else{yoono.dom.$("signin-pane-login").removeAttribute("readonly");yoono.dom.$("signin-pane-login").focus()}},100)};Sidebar.prototype.signIn_display_forgotPasswordView=function signIn_display_forgotPasswordView(){this.signIn_hide_errorMessage("signin-pane-forgot-password-errormsg");yoono.dom.$("signin-pane-signin-registered").style.display="none";yoono.dom.$("signin-pane-forgot-password-view").style.display="block";yoono.dom.$("signin-pane-forgot-password-email").focus();yoono.dom.show(yoono.dom.$("signin-pane-forgot-password-sendbt"));yoono.dom.hide(yoono.dom.$("signin-pane-forgot-password-continue"));this.signIn_throbber=new ThrobberCtrl(yoono.dom.$("signin-pane-forgot-password-throbber"))};Sidebar.prototype.signIn_display_signinView=function signIn_display_signinView(a){var b=this.userCredential.anonymous;if(b){yoono.dom.$("signin-pane-signin-registered").style.display="none";yoono.dom.$("signin-pane-more-privacy").style.display="block";yoono.dom.$("signin-pane-note").style.display="none";yoono.dom.$("signin-pane-signin-anonymous").style.display="block"}else{yoono.dom.$("signin-pane-signin-registered").style.display="block";yoono.dom.$("signin-pane-more-privacy").style.display="none";yoono.dom.$("signin-pane-note").style.display="block";yoono.dom.$("signin-pane-signin-anonymous").style.display="none"}this.signIn_hide_errorMessage("signin-pane-signin-errormsg");yoono.dom.$("signin-pane-forgot-password-view").style.display="none";yoono.dom.$("signin-pane-login").value=this.userCredential.login;if(a){yoono.form.selectFieldContent(yoono.dom.$("signin-pane-password"))}this.signIn_throbber=new ThrobberCtrl(yoono.dom.$("signin-pane-signin-throbber"))};Sidebar.prototype.signIn_hide_errorMessage=function signIn_hide_errorMessage(b){var a=yoono.dom.$(b);a.innerHTML="";a.style.display="none"};Sidebar.prototype.signIn_display_errorMessage=function signIn_display_errorMessage(b,d,a){var c=yoono.dom.$(d);c.innerHTML=yoono.localization.translate(a,YLanguages);c.style.display="block";if(b){yoono.form.selectFieldContent(b)}};Sidebar.prototype.signIn_onActivateBtClick=function signIn_onActivateBtClick(){var a=false;var b=this.userCredential.anonymous;if(b){a=true}else{this.checkLogin("")}if(a){this.signIn_enableSidebar_callback(true)}else{yoono.form.selectFieldContent(yoono.dom.$("signin-pane-password"))}};Sidebar.prototype.signIn_busyfy=function signIn_busyfy(){if(this.signIn_throbber){this.signIn_throbber.play()}};Sidebar.prototype.signIn_unbusyfy=function signIn_unbusyfy(){if(this.signIn_throbber){this.signIn_throbber.stop()}};Sidebar.prototype.signIn_remindPassword=function signIn_remindPassword(){var d=$("signin-pane-forgot-password-email");var c=YTools.getFieldValue(d);if(!YTools.checkEmailSyntax(c)){this.signIn_display_errorMessage(d,"signin-pane-forgot-password-errormsg","Invalid email address");return}var b=this.serverUrl+"rest/user/"+encodeURIComponent(c)+"/sendpassword";this.signIn_busyfy();var a=this;YServices.ajax(b,{method:"get",onSuccess:function(e){a.signIn_display_errorMessage(d,"signin-pane-forgot-password-errormsg","An email with the credentials was sent to this address.");yoono.dom.hide(yoono.dom.$("signin-pane-forgot-password-sendbt"));yoono.dom.show(yoono.dom.$("signin-pane-forgot-password-continue"));a.signIn_unbusyfy()},on404:function(e){a.signIn_display_errorMessage(d,"signin-pane-forgot-password-errormsg","This email was not found in our database.");a.signIn_unbusyfy()},onFailure:function(e){a.signIn_display_errorMessage(d,"signin-pane-forgot-password-errormsg","Server Error - please try again");a.signIn_unbusyfy()}})};Sidebar.prototype.signIn_createAccount=function signIn_createAccount(){this.showConfig("register")};Sidebar.prototype.signIn_isSidebarDisabled=function signIn_isSidebarDisabled(){return this.getKeyValue("sidebarDisabled")||false};Sidebar.prototype.signIn_disableSidebar=function signIn_disableSidebar(){yoono.require("yoono.dialog");var b=this;var a=new yoono.dialog.DialogCtrl(this.languages);var d=this.userCredential.anonymous;a.setTitle(this.translateText("Sign out of Yoono?"));a.setMessageIcon("warning");var c=(d?"":"<b>"+this.translateText("Your Yoono password will be required to reconnect")+".</b><br><br>")+this.translateText("Signing out closes all Yoono connections to your services and stops updates until you sign in again.");a.setMessage(c);a.addButton("no-bt","Cancel",function(){this.close()},true);a.addButton("yes-bt",this.translateText("Yes, Sign Out"),function(){this.close();b.signIn_disableSidebar_callback()});a.setWidth(450);a.setHeight(200);a.open()};Sidebar.prototype.signIn_enableSidebar_callback=function signIn_enableSidebar_callback(a){this.setKeyValue("sidebarDisabled",false);var b=this.getKeyValue("sidebarDisabled_services");if(b){if(b.highlighter&&YServices.highlighter){YServices.highlighter.setEnabled(true)}}yoono.dom.hide(yoono.dom.$("signin-pane"));this.showSidebar(a);this.saveYoodgets()};Sidebar.prototype.signIn_disableSidebar_callback=function signIn_disableSidebar_callback(){var b={};if(YServices.highlighter&&YServices.highlighter.isEnabled()){b.highlighter=true;YServices.highlighter.setEnabled(false)}this.setKeyValue("sidebarDisabled_services",YServices.json.encode(b));this.saveYoodgets();this.setKeyValue("sidebarDisabled",true);for(var a in this.yoodgets){this.removeYoodget(a,-1)}if(!this.userCredential.anonymous){this.YEXTIF.execFct("setUserId",this.userCredential.login+":")}this.signIn_display_signInPane();if(window.YServices&&YServices.accountsManager){YServices.accountsManager.onPostLoginInit(YServices.accountsManager.YOONO_USER_SIGNED_OUT,null)}};